home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
201-225
/
214
/
memdiag
/
md.doc
< prev
next >
Wrap
Text File
|
1995-03-13
|
7KB
|
156 lines
MD--Memory Diagnostic
SYNOPSIS: (CLI environment)
stack 10000
MD [>reportfile] [-qaddressfile]
DESCRIPTION:
MD is a memory diagnostic program. It tests your system's memory and
reports any addresses where errors occur. A memory error occurs when the
value read from an address is not the value which was stored there.
MD runs from the Command Line Interface (CLI). It requires a stack
size of 10000 bytes. It writes its report to standard output. It also
sends status messages to standard error. If you want to save the report for
later review (and separate it from the status messages) redirect standard
output to a file (for example, "MD >MD.rpt").
COMMAND LINE OPTIONS:
The "-q" option builds a file of bad addresses for use by MQ, the
memory quarantine program. Specify the filename to which you want the
addresses written immediately after the q without a space. The file will
contain a list of addresses where MD found an error.
If you suspect intermittent memory problems you should run MD
repeatedly, saving the output to different files. By comparing several
reports you can identify addresses which fail occasionally. The quarantine
files MD produces are ASCII characters so you can edit them as necessary to
build a complete list of defective addresses.
MD tests memory by comparing values read from an address with a known
value previously written to that address. It does not interfere with other
tasks in the system (except by soaking up memory which they might need). It
sends its report to standard output so it can be redirected to a disk file
or printer.
INPUT:
MD does not read external data.
OUTPUT:
The diagnostic report begins with a header identifying the program,
author, and version, and the time of the test. Next it lists the blocks of
memory it examined. The listing gives the block's number, address (in
hexadecimal notation), and size (in decimal). Errors are listed as they are
encountered, one to a line. The line identifies the address where the error
occurred, the value found at that address, and the value MD expected to
find. All values are hexadecimal. For example:
ERROR! Address: 21646C found: 20 expected: 0
At the end of the report MD records the number of errors it found.
As MD executes it displays status messages. The messages advise the
user MD is allocating blocks, sorting them, initializing blocks, and testing
them. They identify the block number and its size as well as the value used
to initialize or test it.
If the -q option is specified on the command line MD will list all the
addresses where memory errors occurred to the specified file. The addresses
are expressed as ASCII characters representing hexadecimal values. Each
address is on a separate line. The addresses are sorted in ascending order
and there are no duplicates.
EXECUTION:
MD takes about 8 minutes to test a 2.5MB machine. During that time
there will not be enough memory left to run other jobs. When MD finishes,
however, it will release all the memory it used and other jobs can resume
without rebooting. MD will not interfere with other jobs that are executing
when it is invoked but it is possible to create a deadlock if there are
other active jobs in the system. Besides that, MD cannot test memory that
is allocated to another process. Consequently, it is best to run MD
immediately after booting the system.
The recommended way to run MD is to create a special Workbench boot
disk with at least 200 free blocks. Deleting the Utilities directory will
free that much space from a standard Workbench disk. Copy MD to the disk.
Change the Startup-Sequence file in the s directory to set the stack size to
10000. After booting with this disk use the date command to set the date
and time if necessary. Then you can execute MD as many times as you wish,
directing the output to a different file each time. By examining the
reports you can identify the addresses where memory errors occurred.
PROGRAM LOGIC:
MD is quite simple. It allocates all the memory the system will give
it. Then it writes a value into each address. It compares the value it
reads back with the one it wrote and if they're different it records the
error.
The algorithm for allocating memory is straightforward. MD begins by
requesting a 1MB block of memory. Each time its request is successful it
repeats it. When the request fails MD cuts its block size in half and tries
again. The iteration ends when MD can't get any 1-byte blocks.
MD sorts the blocks into ascending order so the report it produces will
be a little easier to follow. That's purely a cosmetic feature to make the
user more comfortable. (Remember, I was the user for whom it was written
and ordered lists make more sense to me.)
MD tests memory with four values. They are 0, 0xff, 0x55, and 0xaa.
The test begins by initializing all the bytes in each block to 0. Next the
contents of each byte are compared to 0. If the values don't match MD
reports the error. It stores the next test value at that address and moves
on. When all the memory has been checked for the first value and loaded
with the next value MD makes a second pass through all the memory. A third
pass checks for 0x55 and loads 0xaa. The final pass looks for 0xaa in each
byte.
At first glance it seems less efficient to make so many passes through
memory. Why not test all four values at each byte before moving on to the
next address? There are two reasons. Had the program been written
something like this:
char *address;
for (address = start; address < end; address++)
{
*address = 0;
if (*address != 0)
printf("ERROR! ...");
*address = 0xff;
if (*address != 0xff)
printf("ERROR! ...");
}
the compiler might outsmart you. It could see that nothing is done with
*address so it might keep it in a register to speed up the program. It
would be fast, all right, but it wouldn't tell you anything.
The second reason is to allow time for memory errors to occur. The
approach I used reduces the possibility that an address might hold the
correct value briefly but lose it after some time has passed. I don't know
how probable that is. It seemed a good idea to prevent it anyway.
After all the blocks have been tested MD returns them to the system's
memory free list.
Send questions, comments, or bug reports to:
--Fabbian Dufoe
350 Ling-A-Mor Terrace South
St. Petersburg, Florida 33705
813-823-2350
UUCP: ...uunet!pdn!jc3b21!fgd3